import service from "./request";

export function user_login(params = {}) { //登录
    return service.post('/user/login', params)
}

export function user_register(params = {}) { //注册
    return service.post('/user/register', params)
}

export function shop_list(params = {}) { //首页列表
    return service.get('/shop/list', { params })
}

export function shop_info(params = {}) {
    return service.get('/shop/shopinfo', { params }) //详情页
}

export function tuan_list(params = {}) {
    return service.get('/tuan/list', { params }) //爆爆团
}

export function banner_list(params = {}) {
    return service.get('/banner/list', { params }) //轮播图无参数
}

export function shop_search(params = {}) {
    return service.get('/shop/search', { params }) //搜索。searchkey关键词有参
}

export function shop_fav(params = {}) {
    return service.post('/shop/fav', params) //收藏店铺 userid 用户id 必须传 ; shopid 店铺id 必须传
}

export function shop_favlist(params = {}) {
    return service.get('/shop/favlist', { params }) //收藏店铺列表 userid 用户id 必须传 
}

export function shop_unfav(params = {}) {
    return service.post('/shop/unfav', params) //取消收藏店铺列表 userid 用户id 必须传 ; shopid 店铺id 必须传
}

export function shopcart_list(params = {}) {
    return service.get('/shopcart/list', { params }) //购物车列表 userid必须传
}
export function shopcart_clear(params = {}) {
    return service.post('/shopcart/clear', params) //购物车清空 userid必须传
}

export function shopcart_add(params = {}) {
    return service.post('/shopcart/add', params) //购物车数量加1  userid必须传 goodid必须传
}

export function shopcart_sub(params = {}) {
    return service.post('/shopcart/sub', params) //购物车数量减1  userid必须传 goodid必须传
}

export function address_list(params = {}) {
    return service.get('/address/list', { params }) //收货地址列表
}

export function address_add(params = {}) {
    return service.post('/address/add', params) //新建收货地址 
    // userid 用户id ; address 联系地址 ; phone 联系方式 ; name 联系人 都是必传参数
}

export function address_del(params = {}) {
    return service.post('/address/del', params) //删除收货地址
    // userid 用户id 必须传; addressid 地址id 必须传;
}

export function address_edit(params = {}) {
    return service.post('/address/edit', params) //编辑收货地址
}